<template>
  <div>
    <!--监听-->
    <p>{{ msg }}</p>
    <p>{{ userNum }}</p>
    <slot></slot>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  props: ["msg"],
  data() {
    return {};
  },
  watch: {
    msg: async (newVal, oldVal) => {
      window.console.log(oldVal + "___" + newVal);
    },
    userNum: async newVal => {
      window.console.log(newVal + "新数据");
    }
  },
  computed: {
    ...mapGetters("component", ["userNum"])
  }
};
</script>
